<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ts_nav.*" %>
<%@page import="java.util.*" %>
<%@page import="com.lmpop.frame.util.PageTools" %>
<%
	request.setCharacterEncoding("UTF-8");
	Ts_nav ts_nav = new Ts_nav();
	String navname = "";
	if(request.getParameter("navname")!=null && !request.getParameter("navname").equals("")){
		navname = request.getParameter("navname");
		ts_nav.setNav_name(navname);
	}

	String s_cust_id = "100000000000000";
	if(session.getAttribute("session_cust_id")!=null && !((String)session.getAttribute("session_cust_id")).equals("")){
		s_cust_id = (String)session.getAttribute("session_cust_id");
	}
	ts_nav.setCust_id(s_cust_id);
	String navpost = "";
	if(request.getParameter("navpost")!=null && !request.getParameter("navpost").equals("")){
		navpost = request.getParameter("navpost");
		ts_nav.setNav_post(navpost);
	}	
	Ts_navInfo ts_navInfo = new Ts_navInfo();
	String iStart = "0";
	int limit = 20;
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	List list = ts_navInfo.getListByPage(ts_nav,Integer.parseInt(iStart),limit);
	int counter = ts_navInfo.getCountByObj(ts_nav);
	String pageString = new PageTools().getGoogleToolsBar(counter,"index.jsp?navname="+navname+"&navpost="+navpost+"&iStart=",Integer.parseInt(iStart),limit);
%>
<html>
  <head>
    
    <title>导航栏管理</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="/js/commen.js"></script>
	<script type="text/javascript" src="nav.js"></script>
</head>

<body>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<h1>导航栏管理</h1>
			</td>
			<td>
				<a href="addInfo.jsp"><img src="/program/admin/index/images/post.gif" /></a>
			</td>
		</tr>
	</table>
	
	<form action="index.jsp" name="indexForm" method="post">
      <!--<table width="100%" align="center" cellpadding="0" cellspacing="0" class="dl_so">
        <tr>
          <td width="9%" align="center"><img src="/program/admin/index/images/ban_01.gif" /></td>
          <td width="91%" align="left">
		  <h4>您可以按“行业”或“关键字”订阅</h4>
		  <span>1、填写关键字，您将及时了解与该产品相关的所有商机。</span><br/>
		  <span>2、为了更准确订阅，建议你选择产品所属的行业大类和行业子类。</span>
		  </td>
        </tr>
      </table>-->

      <table width="100%" cellpadding="0" cellspacing="0" class="dl_su">
		<tr>
			<td align="left">
				导航名称:<input name="navname" id="navname" type="text" />
				子系统:<select name="navpost" id="navpost" >	
			<option value="">请选择</option>
					<option value="0">B2B</option>
					<option value="1">团购</option>
					<option value="2">b2c商城</option>
					<option value="3">c2c商铺</option>
			   </select>		
		  <input name="searchInfo" type="button" onClick="return search()" value="查询"/>		  </td>
		</tr>
	</table>

	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<% 
		int listsize = 0;
		if(list!=null && list.size()>0){
			listsize = list.size();
	%>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onClick="delIndexInfo()" value="删除" class="buttab"/>		  
				<input type="button" name="sortN" onClick="sortNews(this)" value="排序" class="buttab"/>
			</td>	
			<td>
				总计:<%=counter %>条		  </td>
		</tr>
	</table>
	
	<table width="100%" cellpadding="1" cellspacing="1" class="listtab" border="0">
		<tr>
			<th width="5%" align="center"><input type="checkbox" name="checkall" id="checkall" onClick="selectAll()"></th>
			
		  	<th>导航名称</th>
		  	
		  	<th>是否显示</th>
		  	
		  	<th>排序</th>
		  	
		  	<th>是否打开新窗口</th>
		  	
		  	<th>子系统</th>
		  	
			<th width="10%">修改</th>
	  		<th width="10%">删除</th>
		</tr>
		
		
		<% 
		  		for(int i=0;i<list.size();i++){
		  			Hashtable map = (Hashtable)list.get(i);
		  			String nav_id="",cust_id="",nav_name="",ifshow="",sort_order="",opennew="",link_url="",nav_post="";
		  			  	if(map.get("nav_id")!=null) nav_id = map.get("nav_id").toString();
						if(map.get("cust_id")!=null) cust_id = map.get("cust_id").toString();
						if(map.get("nav_name")!=null) nav_name = map.get("nav_name").toString();
						if(map.get("ifshow")!=null) ifshow = map.get("ifshow").toString();
						if(map.get("sort_order")!=null) sort_order = map.get("sort_order").toString();
						if(map.get("opennew")!=null) opennew = map.get("opennew").toString();
						if(map.get("link_url")!=null) link_url = map.get("link_url").toString();
						if(map.get("nav_post")!=null) nav_post = map.get("nav_post").toString();
						String showState="",openState="",navPostState="",cust_name="";
  	
						if(ifshow.equals("0")){
							showState="是";
						}else if(ifshow.equals("1")){
							showState="否";
						}
						if(opennew.equals("0")){
							openState="是";
						}else if(opennew.equals("1")){
							openState="否";
						}
						if(nav_post.equals("0")){
							navPostState="B2B";
						}else if(nav_post.equals("1")){
							navPostState="团购";
						}else if(nav_post.equals("2")){
							navPostState="b2c商城";						
						}else if(nav_post.equals("3")){
							navPostState="c2c商城";
						}	
									
		  %>
		
		<tr>
			<td width="5%" align="center"><input type="checkbox" name="checkone<%=i %>" id="checkone<%=i %>" value="<%=nav_id %>" /></td>
			
		  	<td><%=nav_name%></td>
		  	
		  	<td><%=showState%></td>
		  	
		  	<td><input type="text" id="<%=nav_id%>" name="<%=nav_id%>" value="<%=sort_order%>" size="4" maxlength="2" onKeyUp="if(!/^[0-9][0-9]*$/.test(this.value))this.value=''"></td>
		  	
		  	<td><%=openState%></td>
		  	
		  	<td><a href="index.jsp?navpost=<%=nav_post%>"><%=navPostState%></a></td>
		  	
			<td width="10%"><a href="updateInfo.jsp?nav_id=<%=nav_id%>&navname=<%=java.net.URLEncoder.encode(navname)%>&navpost=<%=navpost%>&iStart=<%=iStart%>"><img src="/program/admin/images/edit.gif" title="修改" border="0"/></a></td>
	  		<td width="10%"><a href="javascript:delOneNews('<%=nav_id%>');"><img src="/program/admin/images/delete.gif" title="删除" border="0"/></a></td>
		</tr>
		
		  <%
		  		}
		  %>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onClick="delIndexInfo()" value="删除" class="buttab"/>
				<input type="button" name="sortN" onClick="sortNews(this)" value="排序" class="buttab"/>
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<%
		 }
	%>
	
	  <input type="hidden" name="listsize" id="listsize" value="<%=listsize %>" />
	  <input type="hidden" name="pkid" id="pkid" value="" />
	  <input type="hidden" name="sort" id="sort" value="" />
	  <input type="hidden" name="bpm_id" id="bpm_id" value="5428" />
</form>
</body>

</html>
